import Service from "./$axios";
import { appName } from "../config";
// const appName = ''

// 批号进度刷新
export const updateBatchRefresh = () => {
  return Service({
    url: `${appName}/workOrder/updateBatchRefresh`,
    method: "get",
  });
};

// 查询工单批号列表[1]
export const findPlanAll = (data) => {
  return Service({
    url: `${appName}/workOrder/findPlanAll`,
    method: "post",
    data: data,
  });
};
// 试机的工序接口/workOrder/findMachineWorkDetailsAll
export const findMachineWorkDetailsAll = (data) => {
  return Service({
    url: `${appName}/workOrder/findMachineWorkDetailsAll`,
    method: "post",
    data: data,
  });
};

// 查询工单批号列表详情[2]
export const findPlanDetailsAll = (data) => {
  return Service({
    url: `${appName}/workOrder/findPlanDetailsAll`,
    method: "post",
    data: data,
  });
};

// 查询工单批号列表详情-工序详情
export const findPlanDetailsMaterial = (data) => {
  return Service({
    url: `${appName}/workOrder/findPlanDetailsMaterial`,
    method: "post",
    data: data,
  });
};

// 派工班组查询
export const findGroupAll = () => {
  return Service({
    url: `${appName}/workOrder/findGroupAll`,
    method: "get",
  });
};
// 派工工序查询
export const findProcedureAll = () => {
  return Service({
    url: `${appName}/workOrder/findProcedureAll`,
    method: "get",
  });
};
// 派工[3]
export const addWorkOrderDispatch = (data) => {
  return Service({
    url: `${appName}/workOrder/addWorkOrderDispatch`,
    method: "post",
    data: data,
  });
};
// 取消派工
export const updateCancelDispatch = (data) => {
  return Service({
    url: `${appName}/workOrder/updateCancelDispatch?${data}`,
    method: "get",
  });
};

// 开工[4]
export const addWorkOrderStart = (data) => {
  return Service({
    url: `${appName}/workOrder/addWorkOrderStart`,
    method: "post",
    data: data,
  });
};

// 报工[5]
export const addWorkOrderReport = (data) => {
  return Service({
    url: `${appName}/workOrder/addWorkOrderReport`,
    method: "post",
    data: data,
  });
};

// 申请试机[6]
export const addWorkOrderMachine = (data) => {
  return Service({
    url: `${appName}/workOrder/addWorkOrderMachine`,
    method: "post",
    data: data,
  });
};

// 试机指派查询[7]
export const findMachineAssignAll = (data) => {
  return Service({
    url: `${appName}/workOrder/findMachineAssignAll`,
    method: "post",
    data: data,
  });
};

// 试机指派[8]
export const addMachineAssign = (data) => {
  return Service({
    url: `${appName}/workOrder/addMachineAssign`,
    method: "post",
    data: data,
  });
};

// 查询试机报告[9]
export const findMachineReport = (data) => {
  return Service({
    url: `${appName}/workOrder/findMachineReport`,
    method: "post",
    data: data,
  });
};

// 修改试机报告[9]
export const updateMachineReport = (data) => {
  return Service({
    url: `${appName}/workOrder/updateMachineReport`,
    method: "post",
    data: data,
  });
};

// 申请检验[12]
export const addWorkOrderCheck = (data) => {
  return Service({
    url: `${appName}/workOrder/addWorkOrderCheck`,
    method: "post",
    data: data,
  });
};

// -------------- yyr --------------
// 查询生产订单(父表)
export const queryProductionOrderParent = (data) => {
  return Service({
    url: `${appName}/ProductionOrderManage/queryProductionOrderParent?${data}`,
    method: "get",
  });
};
// 查询生产订单(子表)
export const queryProductionOrderChildren = (data) => {
  return Service({
    url: `${appName}/ProductionOrderManage/queryProductionOrderChildren?batchNo=${data}`,
    method: "get",
  });
};
export const clickAssignProductionOrder = () => {
  return Service({
    url: `${appName}/ProductionOrderManage/clickAssignProductionOrder`,
    method: "get",
  });
};
export const clickAssignProductionOrder1 = () => {
  return Service({
    url: `${appName}/ProductionOrderManage/clickAssignProductionOrder1`,
    method: "get",
  });
};
// 点击开工或报工
export const clickStartOrReportProductionOrder = (data) => {
  return Service({
    url: `${appName}/ProductionOrderManage/clickStartOrReportProductionOrder`,
    method: "post",
    data: data,
  });
};
// 派工
export const assignProductionOrder = (data) => {
  return Service({
    url: `${appName}/ProductionOrderManage/assignProductionOrder`,
    method: "post",
    data: data,
  });
};
// 开工
export const startProductionOrder = (data) => {
  return Service({
    url: `${appName}/ProductionOrderManage/startProductionOrder`,
    method: "post",
    data: data,
  });
};
// 报工
export const reportProductionOrder = (data) => {
  return Service({
    url: `${appName}/ProductionOrderManage/reportProductionOrder`,
    method: "post",
    data: data,
  });
};
// 点击申请试机
export const applyForTestMachine = (data) => {
  return Service({
    url: `${appName}/ProductionOrderManage/applyForTestMachine`,
    method: "post",
    data: data,
  });
};
// 申请试机
export const applyTestMachine = (data) => {
  return Service({
    url: `${appName}/ProductionOrderManage/applyTestMachine`,
    method: "post",
    data: data,
  });
};

// 点击申请质检
export const applyForQualityCheck = (data) => {
  return Service({
    url: `${appName}/ProductionOrderManage/applyForQualityCheck`,
    method: "post",
    data: data,
  });
};
// 申请质检
export const applyQualityCheck = (data) => {
  return Service({
    url: `${appName}/ProductionOrderManage/applyQualityCheck`,
    method: "post",
    data: data,
  });
};

// 点击申请入库
export const clickApplyForEnterWarehouse = (data) => {
  return Service({
    url: `${appName}/ProductionOrderManage/clickApplyForEnterWarehouse`,
    method: "post",
    data: data,
  });
};
// 申请入库
export const applyEnterWarehouse = (data) => {
  return Service({
    url: `${appName}/ProductionOrderManage/applyEnterWarehouse`,
    method: "post",
    data: data,
  });
};
// 导出（父表）
export const exportProductionOrderParentExcel = (data) => {
  return Service({
    url: `${appName}/ProductionOrderManage/exportProductionOrderParentExcel`,
    method: "post",
    data: data,
    responseType: "blob",
  });
};

// 导出(生产订单管理子表)
export const exportProductionOrderChildExcel = (data) => {
  return Service({
    url: `${appName}/ProductionOrderManage/exportProductionOrderChildExcel`,
    method: "post",
    data: data,
    responseType: "blob",
  });
};
//  查询详情（某工序）
export const queryProductionOrderManageDetail = (data) => {
  return Service({
    url: `${appName}/ProductionOrderManage/queryProductionOrderManageDetail?${data}`,
    method: "get",
  });
};
// 导出（工序详情）
export const exportProductionOrderManageDetailExcel = (data) => {
  return Service({
    url: `${appName}/ProductionOrderManage/exportProductionOrderManageDetailExcel`,
    method: "post",
    data: data,
    responseType: "blob",
  });
};
